# upper = float(input('上底是：'))
# down_ = float(input('下底是：'))
# height = float(input('高是：'))
# area = (upper + down_) * height / 2
# print ('面积是：',area)

# nl=int(input('输入年龄:'))
# print('miangnianduoda:',str(nl+1),'sui')

# answer=42
# answer1=20
# answer=answer1
# print(answer)
# print(int(input("存款"))>=50000)
# a=int(input('cunkuang'))
# print(a>=50000)

# if input('脱不脱产')=='脱':
#     print('工作日上课')
# else:
#     print('不上课')

# a=int(input('输入智商指数：\n'))
# if a<80:
#     print('低能')
# elif a>=80and a<90:
#     print('迟钝')
# elif a >= 90 and a < 109:
#     print('正常')
# elif a >=110 and a < 120:
#     print('聪慧')
# elif a >= 120 and a < 140:
#     print('超常')
# else:
#     print('天才')

# count = 0
# while count<=3:
#     print(count)
#     count+=1
# for num in range(3):
#     if 36<= float(input('体温')) <=37:
#         print("正常")
#     else:
#         print("异常")
# MA=int(input('心理年龄：\n'))
# CA=int(input('实际年龄：\n'))
# a=(MA/CA)*100
# if a<80:
#     print('低能')
# elif a>=80and a<90:
#      print('迟钝')
# elif a >= 90 and a < 109:
#      print('正常')
# elif a >=110 and a < 120:
#     print('聪慧')
# elif a >= 120 and a < 140:
#      print('超常')
# else:
#      print('天才')

# diqu_list =['陕西','浙江','广西']
# xzrs_list=[182,2,3]
# xyrs_list=[859,505,256]
#
# ard = diqu_list
# print(ard)
# print('山西'not in diqu_list)
# diqu_list.append('guangdong')
# print(ard)
# diqu_list.insert(0,'shanxi')
# print(ard)
# qiepian_list = diqu_list[1:]
# print(qiepian_list)
# list_pop = [1111,2222,1827]
# for item in list_pop:
#     if item >2000:
#         print(item)
# list_number =[66,25,72,86,57]
# list_new =[]
# for item in list_number:
#     if item>60:
#         list_new.append(item)
#         print(list_new)
# list_new =[]
# while True:
#     item = input()
#     list_new.append(item)
#     if item =='0':
#         break
# list_new =[1,2,3]
# for num in range(5):
#     item=int(input())
#     list_new.append(item)
#
# print(list_new)
# name = "张无忌"
# names = ["赵敏", "周芷若"]
# tuple01 = ("张翠山", name, names)
# name = "无忌哥哥"
# tuple01[2][0] = "敏儿"
# print(tuple01)
# dictionary = {}
# name = "钱一"
# names = ["赵二","孙三","李"]
# tuple01 =("张三",name,names)
# name = ("周")
# tuple01[2][0] = ("刘")
# print(tuple01)
# print("""花果山'水帘洞'"美猴王"孙悟空""")
# print("花果山\"水帘洞\"美猴王孙悟空")
# print("花果山水帘洞\n美猴王孙悟空")
# name = "大圣"
# money=2.334
# age=23
# num=6
# print("我今年%d岁，喜欢的数字是：%s，身上还有%.2f元的零钱"%(age,num,money))
# dict_bjlz = {
#     "name":"八角笼中","type":"剧情",
#     "actor":"王宝强","index":690761,
# }
# print("名称" + dict_bjlz["name"]
#       +"\n类型"+ dict_bjlz["type"]
#       +"\n演员"+ dict_bjlz["actor"]
#       +"\n指数"+ str(dict_bjlz["index"])
#       )
# dict_movie = {"bjlz":"jq",",mjh":"jq"}
# print(dict_movie) # {"剧情":"满江红"}
# # TypeError: unhashable type: 'list'
# dict_movie = {("王宝强","陈永胜"):"八角笼中"}
# print(dict_movie)
# dict_bjlz = {
# "name":"八角笼中","type":"剧情",
# }
# for key in dict_bjlz:
#   print(key)

# list_new =[14,4432,423,5131,1311,42]
# list_names =["赵","孙","李","周","吴","钱"]
# list_add =["王","张","刘"]
# list_adnames =list_names +list_add
# list_newnames = {
#      list_adnames[i]: (
#          list_new[i] if i < len(list_new)
#          else list_new[i - len(list_new)]
#     )
#     for i in range(len(list_adnames))
# }
# print(list_newnames)

# list_newss = {list_add[i]:list_new[i]for i in range(len(list_add) )  }
# list_news = {list_names[i]:list_new[i]for i in range(len(list_new) )  }
# list_news.update(list_newss)
# print(list_news)
# def attack(count):
#     for i in range(count):
#         print("zhiquan")
#         print("gouquan")
#         print("chongquan")
# attack(5)
# def prtlist(item):
#     list01 = [5, 546, 6, 56, 76, ]
#     list02 = [7, 6, 879, 9, 909, ]
#     for i in range(item):
#         print(list01)
#         print(list02)
#     return 1
#
# a = prtlist(3)
# print(a)
# def func03():
#      print("func03执行了")
#      return
#      print("func03又执行了")
# func03()
# def func01(p1, p2):
#     p1 = "孙悟空"
#     p2["八戒"] += 50
#     return 1
# a = "悟空"
# b = {"八戒": 100}
# func01(a, b)
# print(a) # ?
# print(b) # ?

# def time(h,m,s):
#     times=3600*h+60*m+s
#     print(times)
#     return 1
# a=time(1,2,5)
# print(a)

# class Person:
#     def teach(name1,name2,gongfu):
#         print("%s教%s%s"% (name1,name2,gongfu))
# gf1 = Person.teach("张无忌","赵敏","九阳神功")
# gf2 = Person.teach("赵","张","九阴")

# class Person:
#     def __init__(self,name):
#         self.name = name
# class Car:
#     def __init__(self,car):
#         self.car = car
# class Position:
#     def __init__(self,p1):
#         self.p1 = p1
# lz=Person("老张")
# car=Car("车")
# df=Position("河北")
# def goto(r,c,d):
#     print("%s开%s去%s" % (r,c,d))
# goto(lz.name, car.car, df.p1)

# class MyClass:
#     def __init__(self, data):
#         self.__data = data
#     def __func01(self):
#         print("func01执行了")
# m01 = MyClass(10)
# # print(m01.__data) # 无法访问
# print(m01._MyClass__data)
# print(m01.__dict__) # {'_MyClass__data': 10}
# # m01.__func01() # 无法访问
# m01._MyClass__func01()

# class Person:
#     def say(self):
#         print("说话")
#     def __sleep(self):
#         print("睡觉")
# class Teacher(Person):
#     def teach(self):
#         self.say()
#         print("教学")
#     def __bk(self):
#         print("备课")
# class Student(Person):
#     def study(self):
#         self.say()
#         print("学习")
#     def __work(self):
#         print("写作业")
# qtx = Teacher()
# qtx.say()
# qtx.teach()
# qtx._Person__sleep()
# qtx._Teacher__bk()
# xm = Student()
# xm.say()
# xm.study()
# xm._Student__work()

# class Animal():
#     def eat(self):
#         print("吃")
#     def __sleep(self):
#         print("睡觉")
# class Dog(Animal):
#     def run(self):
#         print("跑")
#     def __tm(self):
#         print("舔毛")
# class Eha(Dog):
#     def lache(self):
#         hsq.eat()
#         hsq.run()
#         print("拉车")
#     def __fs(self):
#         print("犯傻")
# class Bird(Animal):
#     def fly(self):
#         print("飞")
#     def __fd(self):
#         print("孵蛋")
# class Yw(Bird):
#     def __say(self):
#         print("说话")
#     def qo(self):
#         yw.eat()
#         yw.fly()
#         print("求偶")
#
# hsq = Eha()
# hsq._Animal__sleep()
# hsq._Dog__tm()
# hsq.lache()
# hsq._Eha__fs()
# print("-----")
# yw = Yw()
# yw.qo()
# yw._Animal__sleep()
# yw._Bird__fd()
# yw._Yw__say()
# print("-----")
# print(isinstance(hsq, Animal))
# print(isinstance(hsq, Eha))
# print(isinstance(hsq, Yw))
# print(type(hsq) == Eha)
# print(type(hsq) == Dog)
# print(type(hsq) == Bird)

# class Movie:
#     def __init__(self, name, type, index):
#         self.name = name
#         self.type = type
#         self.index = index
#     def __str__(self):
#         return ("%s电影的类型是%s,指数是%s." % (self.name, self.type, self.index))
# bjlz = Movie("八角笼中","剧情",690761)
# fs = Movie("封神第一部","奇幻",532622)
# print(bjlz)
# print(fs)

# def get_score():
#     while True:
#         try:
#             score = int(input("请输入成绩："))
#             return score
#         except ValueError:
#             print("输入错误，请输入一个整数！")
# score = get_score()
# print("成绩是：%d" % score)

# list_new =[14,4432,423,5131,1311,42]
# i01 = list_new.__iter__()
# while True:
#     try:
#         i02 = i01.__next__()
#         print(i02)
#     except StopIteration:
#         break
# dict_bjlz = {
#     "name":"八角笼中","type":"剧情",
#     "actor":"王宝强","index":690761,
# }
# i03 = dict_bjlz.__iter__()
# while True:
#     try:
#         i04 = i03.__next__()
#         print("%s:%s"%(i04,dict_bjlz[i04]))
#     except StopIteration:
#         break

# class CommodityIterator:
#     def __init__(self, data):
#         self.__data = data
#         self.__index = -1
#
#     def __next__(self):
#         if self.__index == len(self.__data) - 1:
#             raise StopIteration()
#         self.__index += 1
#         return self.__data[self.__index]
#
# class CommodityController:
#     def __init__(self):
#         self.__commodity = []
#
#     def add_commodity(self, sp):
#         self.__commodity.append(sp)
#
#     def __iter__(self):
#          return CommodityIterator(self.__commodity)
# controller = CommodityController()
# controller.add_commodity("屠龙刀")
# controller.add_commodity("倚天剑")
# controller.add_commodity("芭比娃娃")
#
# for item in controller:
#     print(item)
#
# class Myrange:
#     def __init__(self,stop):
#         self.stop=stop
#     def __iter__(self):
#         i=0
#         while i < self.stop:
#             yield i
#             i += 1
#
# for numbers in Myrange(5):
#     print(numbers)
# a=[43,43,54,56,76,87,98]
# def my_range(list):
#     number = 0
#     while number < len(list):
#         yield list[number]
#         number += 1
# for number in my_range(a):
#     if number % 2 == 0:
#         print(f"{number} 是偶数")
#
# b=[1,2,"a",1,"b",True]
# def my_range(list):
#     i = 0
#     while i < len(list):
#         yield list[i]
#         i += 1
# for i in my_range(b):
#     if  type(i) in (int,float):
#         print(f"{i} 是数字")

# def none1(list):
#     for i, item in enumerate(list):
#         if item % 2 == 1:
#             list[i] = None
#     print(list)
# def none2(list):
#     for i, item in enumerate(list):
#         if item % 2 == 0:
#             list[i] += 1
#     print(list)
# list01 = [43, 43, 54, 56, 76]
# none1(list01)
# list02 = [43, 43, 54, 56, 76]
# none2(list02)

# list01 = ["sj", "hsn", "ljy" ]
# list02 = [43, 43, 54]
# list03=["n","v","n","v"]
# for i in zip(list01,list02,list03):
#     print(i)

# 矩阵转置
map=[[1,2,3],
     [4,5,6],
     [7,8,9],
     [1,2,3],
     [4,5,6],
     [1,2,3],
     [4,5,6],
     [7,8,9],
]
new_map=[]
for item in zip(map[0],map[1],map[2]):
    new_map.append(list(item))
print(new_map)

new_map2=[]
for item in zip(*map):
    new_map2.append(list(item))
print(new_map2)

# 列表推导式
new_map3=[list(item) for item in zip(*map)]
print(new_map3)

# 生成器表达式：用推导式形式创建生成器对象，
#变量 =（表达式 for变量 in 可迭代对象 if 判断条件）
new_map4=(list(item) for item in zip (*map))
print(new_map4)   #生成器对象 <generator object <genexpr> at 0x7f2ad2ff2820>
for item in new_map4:
    print(item)